package com.itheima.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.OrderSettingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定期清理预约设置表中的数据
 * @author 二龙
 *
 */
@Slf4j
public class ClearOrdersettingJob {

	@Reference
	OrderSettingService orderSettingService;

	public void clear(){

		log.debug("开始清除垃圾预约设置数据");

		//获取当天日期2020-03-07
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

		String today = sdf.format(new Date());

		System.out.println("today="+today);

		orderSettingService.clearOrdersettingData(today);


		log.debug("预约设置数据清除成功!!");

	}


}
